package models

import "go.didapinche.com/time"

type AccessGraphType string

const (
	HostAccess      AccessGraphType = "host"
	AppAccess       AccessGraphType = "app"
	ApiAccess       AccessGraphType = "api"
	DashboardAccess AccessGraphType = "dashboard"
)

const AccessRecordTableName = "t_access_record"

//todo
// 最近浏览
type AccessRecord struct {
	ID          uint64          `gorm:"primary_key,column:id" json:"id,omitempty" form:"id"`
	AppID       uint64          `gorm:"column:app_id" json:"app_id,omitempty" form:"app_id"`
	ApiID       uint64          `gorm:"column:api_id" json:"api_id,omitempty" form:"api_id"`
	DashboardID uint64          `gorm:"column:dashboard_id" json:"dashboard_id,omitempty" form:"dashboard_id"`
	IP          string          `gorm:"column:ip" json:"ip,omitempty" form:"ip"`
	UID         string          `gorm:"column:uid" json:"uid,omitempty" form:"uid"`
	Name        string          `gorm:"column:name" json:"name,omitempty" form:"name"`
	GraphType   AccessGraphType `gorm:"column:graph_type" json:"graph_type,omitempty" form:"graph_type"`
	CreateTime  time.Time       `gorm:"column:create_time" json:"create_time,omitempty" form:"create_time"`
}

func (AccessRecord) TableName() string {
	return AccessRecordTableName
}
